package Chapter10;

import java.io.RandomAccessFile;

public class Demo01 {
    //使用RandomAccessFile流将log.txt目录中的log.txt文件倒置打印输出
    public static void main(String args[]) throws Exception {
        RandomAccessFile randomAccessFile = new RandomAccessFile("src/Chapter10/log.txt", "r");
        long length_ = randomAccessFile.length();long p = length_ - 1;
        byte[] bytes = new byte[1];
        while (p >= 0) {
            randomAccessFile.seek(p);
            randomAccessFile.read(bytes );
            System.out.print(new String(bytes ));
            p--;
        }
        randomAccessFile.close();
    }



}
